package com.jml.jdk8;

class MyInterfaceTest2 {
    public void myTest(MyInterface myInterface){
        System.out.println(1);
        myInterface.test();
        System.out.println(2);
    }

    public static void main(String[] args) {
        MyInterfaceTest2 test2 = new MyInterfaceTest2();
        test2.myTest(new MyInterface() {
            @Override
            public void test() {
                System.out.println("传统");
            }
        });
        //如果是空参，括号不可省略
        test2.myTest(()-> System.out.println("lambda"));
        //myInterface的一个实现
        MyInterface myInterface = ()-> System.out.println("myInterface的一个实现");
        System.out.println(myInterface.getClass());
        System.out.println(myInterface.getClass().getSuperclass());
        MyInterface1 myInterface1 = ()->{return "123";};
    }
}